package com.zhiy.com.estation.ui.fragment.updata;

import com.zhiy.com.estation.api.ApiResult;
import com.zhiy.com.estation.model.User;

import java.util.HashMap;

import io.reactivex.functions.Consumer;

/**
 * Created by Zyh on 2016/12/6.
 */
public class UpdataPresent extends UpdataContract.Presenter{
    @Override
    public void updata(HashMap<String, String> map) {
        model.updata(map).subscribe(new Consumer<ApiResult<User>>() {
            @Override
            public void accept(ApiResult<User> userApiResult) throws Exception {
                view.showMsg(userApiResult.getMsg());
                if (userApiResult.getCode()==0){
                    view.isUpdataSuccess(userApiResult.getData());
                }else {
                    view.isFailure();
                }
            }
        });

    }
}
